home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / emulator / bsvc-1.000 / bsvc-1 / bsvc-1.0.4 / samples / Motorola68000 / MatrixMultiply.LIS < prev    next >
File List  |  1995-07-26  |  71KB  |  1,021 lines

  1. 00000000                                     1  *
  2. 00000000                                     2  * Interactive Matrix Multiply program for the Motorola 68000
  3. 00000000                                     3  * 
  4. 00000000                                     4  
  5. 00001000                                     5      ORG    $1000
  6. 00001000                                     6  
  7. 00001000  =00EFFC01                          7  DUART    EQU    $effc01
  8. 00001000  =00000000                          8  MR1A    EQU    0
  9. 00001000  =00000000                          9  MR2A    EQU    0
  10. 00001000  =00000002                         10  SRA    EQU    2
  11. 00001000  =00000004                         11  CRA    EQU    4
  12. 00001000  =00000002                         12  CSRA    EQU    2
  13. 00001000  =00000006                         13  TBA    EQU    6
  14. 00001000  =00000006                         14  RBA    EQU    6
  15. 00001000  =0000000A                         15  IMR    EQU    10
  16. 00001000  =00000016                         16  TBB    EQU    $16
  17. 00001000  =00000014                         17  CRB    EQU    $14
  18. 00001000  =00000010                         18  MR1B    EQU    $10
  19. 00001000  =00000010                         19  MR2B    EQU    $10
  20. 00001000  =00000012                         20  SRB    EQU    $12
  21. 00001000                                    21  
  22. 00001000  43F9 00EFFC01                     22      LEA    DUART,A1
  23. 00001006  137C 0010 0004                    23      MOVE.B    #%00010000,CRA(A1)     Reset MR?A pointer
  24. 0000100C  137C 0023 0000                    24      MOVE.B  #%00100011,MR1A(A1)    8 data bits
  25. 00001012  137C 0017 0000                    25      MOVE.B  #%00010111,MR2A(A1)    Normal Mode
  26. 00001018  137C 00BB 0002                    26      MOVE.B  #%10111011,CSRA(A1)    Set clock to 9600
  27. 0000101E  137C 0005 0004                    27      MOVE.B  #%00000101,CRA(A1)     Enable Rx and Tx
  28. 00001024                                    28  
  29. 00001024  2E7C 00004000                     29      MOVE.L    #$4000,A7              Setup the stack pointer
  30. 0000102A                                    30  
  31. 0000102A  4EB9 00001C00                     31  MAIN:    JSR CLEAR
  32. 00001030  4EB9 00001518                     32      JSR TITLE
  33. 00001036                                    33  
  34. 00001036  4EB9 00001C00                     34      JSR CLEAR
  35. 0000103C                                    35  
  36. 0000103C  4EB9 00001CB6                     36      JSR GETSIZE
  37. 00001042                                    37  
  38. 00001042  3239 000010D6                     38      MOVE.W    MA_C,D1
  39. 00001048  3039 000010D4                     39      MOVE.W    MA_R,D0
  40. 0000104E  207C 000010DC                     40      MOVE.L    #MA_DAT,A0
  41. 00001054  227C 000013FC                     41      MOVE.L    #MA_TI,A1
  42. 0000105A  4EB9 000021AA                     42      JSR    MATIN
  43. 00001060                                    43  
  44. 00001060  3239 000010DA                     44      MOVE.W    MB_C,D1
  45. 00001066  3039 000010D8                     45      MOVE.W    MB_R,D0
  46. 0000106C  207C 000011A4                     46      MOVE.L    #MB_DAT,A0
  47. 00001072  227C 0000140C                     47      MOVE.L    #MB_TI,A1
  48. 00001078  4EB9 000021AA                     48      JSR MATIN
  49. 0000107E                                    49  
  50. 0000107E  3039 000010D4                     50      MOVE.W    MA_R,D0
  51. 00001084  3239 000010D6                     51      MOVE.W    MA_C,D1
  52. 0000108A  3439 000010D8                     52      MOVE.W    MB_R,D2
  53. 00001090  3639 000010DA                     53      MOVE.W    MB_C,D3
  54. 00001096  207C 000010DC                     54      MOVE.L    #MA_DAT,A0
  55. 0000109C  227C 000011A4                     55      MOVE.L    #MB_DAT,A1
  56. 000010A2  247C 0000126C                     56      MOVE.L    #MC_DAT,A2
  57. 000010A8  4EB9 00001F24                     57      JSR    MATMULT
  58. 000010AE                                    58  
  59. 000010AE  3039 000010D4                     59      MOVE.W    MA_R,D0
  60. 000010B4  3239 000010DA                     60      MOVE.W    MB_C,D1
  61. 000010BA  207C 0000126C                     61      MOVE.L    #MC_DAT,A0
  62. 000010C0  227C 0000141C                     62      MOVE.L    #MC_TI,A1
  63. 000010C6  4EB9 00001FA2                     63      JSR    MATOUT
  64. 000010CC                                    64  
  65. 000010CC  4EF9 00002468                     65      JMP    EXIT
  66. 000010D2  4E71                              66      NOP
  67. 000010D4                                    67  
  68. 000010D4                                    68  MA_R:    DS.W    1
  69. 000010D6                                    69  MA_C:    DS.W    1
  70. 000010D8                                    70  MB_R:    DS.W    1
  71. 000010DA                                    71  MB_C:    DS.W    1
  72. 000010DC                                    72  MA_DAT:    DS.W    100                Matrix A Data
  73. 000011A4                                    73  MB_DAT:    DS.W    100                             Matrix B Data
  74. 0000126C                                    74  MC_DAT: DS.L    100                Matrix C Data (Result)
  75. 000013FC  45 6E 74 65 72 20 4D 61 74 ...    75  MA_TI:    DC.B    'Enter Matrix A',0,0
  76. 0000140C  45 6E 74 65 72 20 4D 61 74 ...    76  MB_TI:    DC.B    'Enter Matrix B',0,0
  77. 0000141C  52 65 73 75 6C 74 69 6E 67 ...    77  MC_TI:    DC.B    'Resulting Matrix C',0,0
  78. 00001430                                    78  
  79. 00001430                                    79  *
  80. 00001430                                    80  * Input a string
  81. 00001430                                    81  *
  82. 00001430                                    82  
  83. 00001430  48E7 FFFE                         83  INPUT:        MOVEM.L    A0-A6/D0-D7,-(A7)
  84. 00001434                                    84  
  85. 00001434  2A48                              85          MOVE.L    A0,A5            Save buffer address
  86. 00001436  2C49                              86          MOVE.L    A1,A6            Save valid string address
  87. 00001438  2E00                              87                  MOVE.L    D0,D7            Save Max length
  88. 0000143A  7200                              88          MOVE.L    #0,D1            Current string length
  89. 0000143C                                    89  
  90. 0000143C  4EB9 000014F0                     90  IN_LOOP:    JSR    GETC            Get a character
  91. 00001442                                    91  
  92. 00001442  0C00 0008                         92          CMPI.B    #$08,D0            Is it backspace
  93. 00001446  6700 0046                         93          BEQ    IN_BS
  94. 0000144A                                    94  
  95. 0000144A  0C00 000D                         95          CMPI.B    #$0D,D0            Is it return
  96. 0000144E  6700 0074                         96          BEQ    IN_RET
  97. 00001452                                    97  
  98. 00001452                                    98  * Make sure it's a valid character
  99. 00001452  204E                              99          MOVE.L    A6,A0
  100. 00001454  0C10 0000                        100  IN_VL:        CMPI.B    #0,(A0)            End of valid string?
  101. 00001458  6700 000A                        101          BEQ    IN_INVALID
  102. 0000145C                                   102  
  103. 0000145C  B018                             103          CMP.B    (A0)+,D0        Is it a valid char?
  104. 0000145E  6700 000E                        104          BEQ    IN_VALID
  105. 00001462                                   105  
  106. 00001462  60F0                             106          BRA    IN_VL            Loop
  107. 00001464                                   107  
  108. 00001464  4EB9 00001BF4                    108  IN_INVALID:    JSR    BELL            Sound Bell
  109. 0000146A  4EF8 143C                        109          JMP    IN_LOOP            Get another character
  110. 0000146E                                   110  
  111. 0000146E  B247                             111  IN_VALID:    CMP.W    D7,D1            Have we reach max lenght?
  112. 00001470  6600 000C                        112          BNE    IN_VA2            NO!
  113. 00001474                                   113  
  114. 00001474  4EB9 00001BF4                    114          JSR    BELL
  115. 0000147A  4EF8 143C                        115          JMP    IN_LOOP
  116. 0000147E                                   116  
  117. 0000147E  1B80 1000                        117  IN_VA2:        MOVE.B    D0,0(A5,D1)        Save character in buffer
  118. 00001482  5241                             118          ADDI.W    #1,D1            Inc Lenght counter
  119. 00001484  4EB9 000014D0                    119          JSR    PUTC            Output character to screen
  120. 0000148A                                   120  
  121. 0000148A  4EF8 143C                        121          JMP    IN_LOOP
  122. 0000148E                                   122  
  123. 0000148E                                   123  
  124. 0000148E  0C41 0000                        124  IN_BS:        CMPI.W    #0,D1            Make sure no wrap around
  125. 00001492  6600 000C                        125          BNE    IN_BOK
  126. 00001496                                   126  
  127. 00001496  4EB9 00001BF4                    127          JSR    BELL
  128. 0000149C  4EF8 143C                        128          JMP    IN_LOOP
  129. 000014A0                                   129  
  130. 000014A0  103C 0008                        130  IN_BOK:        MOVE.B    #$08,D0            BackSpace on screen
  131. 000014A4  4EB9 000014D0                    131          JSR    PUTC
  132. 000014AA  103C 0020                        132          MOVE.B    #$20,D0
  133. 000014AE  4EB9 000014D0                    133          JSR    PUTC
  134. 000014B4  103C 0008                        134          MOVE.B    #$08,D0
  135. 000014B8  4EB9 000014D0                    135          JSR    PUTC
  136. 000014BE                                   136  
  137. 000014BE  5341                             137          SUBI.W    #1,D1            Dec length counter
  138. 000014C0  4EF8 143C                        138          JMP    IN_LOOP
  139. 000014C4                                   139  
  140. 000014C4                                   140  
  141. 000014C4  1BBC 0000 1000                   141  IN_RET:        MOVE.B    #0,0(A5,D1)        Null Terminate
  142. 000014CA                                   142  
  143. 000014CA  4CDF 7FFF                        143          MOVEM.L    (A7)+,A0-A6/D0-D7    Restore REGS
  144. 000014CE                                   144  
  145. 000014CE  4E75                             145          RTS
  146. 000014D0                                   146  *
  147. 000014D0                                   147  * Routines for performing Polled I/O At the Console Serial Port
  148. 000014D0                                   148  *
  149. 000014D0                                   149  * By: Bradford W. Mott
  150. 000014D0                                   150  *
  151. 000014D0                                   151  
  152. 000014D0  =0000000A                        152  LINEFEED:    EQU    10        * LineFeed Character value
  153. 000014D0  =0000000D                        153  CARR_RETURN:    EQU    13        * Carrage Return character value
  154. 000014D0                                   154  
  155. 000014D0                                   155  *
  156. 000014D0                                   156  * The character in D0 is transmitted to the CONSOLE ACIA.
  157. 000014D0                                   157  * The newline character <LF> is expanded into <LF>/<CR>.
  158. 000014D0                                   158  *
  159. 000014D0                                   159  
  160. 000014D0  0839 0002 00EFFC03               160  PUTC:    BTST    #2,SRA+DUART        * Test Transmit data register empty
  161. 000014D8  67F6                             161      BEQ.S    PUTC            * If not keep polling
  162. 000014DA  13C0 00EFFC07                    162      MOVE.B    D0,TBA+DUART        * Transmit the character
  163. 000014E0  B03C 000A                        163      CMP.B    #LINEFEED,D0        * Check for LINEFEED
  164. 000014E4  6600 0008                        164      BNE    PUTEXT
  165. 000014E8  103C 000D                        165      MOVE.B    #CARR_RETURN,D0        * Load CR into D0
  166. 000014EC  60E2                             166      BRA    PUTC            * Output CR
  167. 000014EE  4E75                             167  PUTEXT:    RTS                * Return to calling procedure
  168. 000014F0                                   168  
  169. 000014F0                                   169  
  170. 000014F0                                   170  *
  171. 000014F0                                   171  * Get a character from the CONSOLE ACIA and return it in D0
  172. 000014F0                                   172  *
  173. 000014F0                                   173  
  174. 000014F0  0839 0000 00EFFC03               174  GETC:    BTST    #0,SRA+DUART        * Test Receive data register full
  175. 000014F8  67F6                             175      BEQ.S    GETC            * If not keep polling
  176. 000014FA  1039 00EFFC07                    176      MOVE.B    RBA+DUART,D0        * Read the character
  177. 00001500  4E75                             177      RTS
  178. 00001502                                   178  
  179. 00001502  2F00                             179  PRINT:        MOVE.L        D0,-(A7)    *SAVE CURRENT REGS TO STACK
  180. 00001504  1018                             180  PRLOOP:        MOVE.B        (A0)+,D0    *GET A CHARACTER
  181. 00001506  B03C 0000                        181          CMP.B        #$00,D0        *IS IT A NULL CHARACTER?
  182. 0000150A  6700 0008                        182          BEQ        PRNTEND        *IF SO, THEN YOU'RE DONE
  183. 0000150E  4EB8 14D0                        183          JSR        PUTC        *IF NOT, THEN SEND CHARACTER TO SCREEN
  184. 00001512  60F0                             184          BRA        PRLOOP        *LOOP UNTIL DONE
  185. 00001514  201F                             185  PRNTEND:    MOVE.L        (A7)+,D0    *RESTORE REGS
  186. 00001516  4E75                             186          RTS
  187. 00001518                                   187  
  188. 00001518                                   188  
  189. 00001518  207C 00001538                    189  TITLE:        MOVE.L     #SCREEN,A0    *INITIALIZE SCREEN DATA POINTER
  190. 0000151E  4EB8 1502                        190  TILP:        JSR    PRINT        *PRINT DATA TO SCREEN
  191. 00001522  0C10 003D                        191          CMPI.B    #$3D,(A0)    *END OF SCREEN DATA?
  192. 00001526  66F6                             192          BNE    TILP        *IF NOT THEN KEEP PRINTING DATA
  193. 00001528  4EB8 14F0                        193  TILP1:        JSR    GETC        *IF FINISHED, GET A KEY SRIKE
  194. 0000152C  0C00 000D                        194          CMPI.B    #$0D,D0        *IS IT THE RETURN KEY?
  195. 00001530  66F6                             195          BNE    TILP1        *IF NOT THEN TRY AGAIN
  196. 00001532  4EB8 1502                        196          JSR    PRINT        *IF SO, THEN PRINT CLEAR SCREEN CHARACTERS
  197. 00001536  4E75                             197          RTS            *RETURN TO MAIN
  198. 00001538                                   198  
  199. 00001538  1B 5B 32 4A                      199  SCREEN:        DC.B    $1B,'[2J'    
  200. 0000153C  2A 2A 2A 2A 08 08 08 08 1B ...   200          DC.B    '****',$08,$08,$08,$08,$1B,'[4h'
  201. 00001548  20 20 20 20 20 20 20 20 20 ...   201          DC.B    '                                                                        ****',$1B,'[4l',$1B,'E'
  202. 0000159A  2A 2A 08 08 1B 5B 34 68          202          DC.B    '**',$08,$08,$1B,'[4h'
  203. 000015A2  20 20 20 20 20 20 20 20 20 ...   203          DC.B    '                                                                            **',$1B,'[4l',$1B,'E'
  204. 000015F6  2A 20 2A 08 08 08 1B 5B 34 68    204          DC.B    '* *',$08,$08,$08,$1B,'[4h'
  205. 00001600  20 20 20 20 20 20 20 20 20 ...   205          DC.B    '                                                                          * *',$1B,'[4l',$1B,'E'
  206. 00001653  2A 08 1B 5B 34 68                206          DC.B    '*',$08,$1B,'[4h'
  207. 00001659  20 20 20 20 20 20 20 20 20 ...   207          DC.B    '                                                                              *',$1B,'[4l',$1B,'E',$1B,'E'
  208. 000016B0  20 20 20 20 20 20 20 20 20 ...   208          DC.B    '                      M   M   A   TTTTT RRRR   III  X   X',$1B,'E'
  209. 000016EB  20 20 20 20 20 20 20 20 20 ...   209          DC.B      '                      MM MM  A A    T   R   R   I    X X ',$1B,'E'
  210. 00001726  20 20 20 20 20 20 20 20 20 ...   210          DC.B    '                      M M M A   A   T   R   R   I     X  ',$1B,'E'
  211. 00001761  20 20 20 20 20 20 20 20 20 ...   211          DC.B    '                      M   M AAAAA   T   RRRR    I    X X ',$1B,'E'
  212. 0000179C  20 20 20 20 20 20 20 20 20 ...   212          DC.B    '                      M   M A   A   T   R  R    I   X   X',$1B,'E'
  213. 000017D7  20 20 20 20 20 20 20 20 20 ...   213          DC.B    '                      M   M A   A   T   R   R  III  X   X',$1B,'E'
  214. 00001812  1B 45                            214          DC.B    $1B,'E'
  215. 00001814  20 20 20 20 20 20 20 20 20 ...   215          DC.B    '                M   M U   U L     TTTTT  III  PPPP  L     Y   Y',$1B,'E'
  216. 00001855  20 20 20 20 20 20 20 20 20 ...   216          DC.B    '                MM MM U   U L       T     I   P   P L     Y   Y',$1B,'E'
  217. 00001896  20 20 20 20 20 20 20 20 20 ...   217          DC.B    '                M M M U   U L       T     I   P   P L      Y Y ',$1B,'E'
  218. 000018D7  20 20 20 20 20 20 20 20 20 ...   218          DC.B     '                M   M U   U L       T     I   PPPP  L       Y  ',$1B,'E'
  219. 00001918  20 20 20 20 20 20 20 20 20 ...   219          DC.B     '                M   M U   U L       T     I   P     L       Y  ',$1B,'E'
  220. 00001959  20 20 20 20 20 20 20 20 20 ...   220          DC.B    '                M   M  UUU  LLLLL   T    III  P     LLLLL   Y  ',$1B,'E'
  221. 0000199A  1B 45                            221          DC.B    $1B,'E'
  222. 0000199C  2A 08 1B 5B 34 68                222          DC.B    '*',$08,$1B,'[4h'
  223. 000019A2  20 20 20 20 20 20 20 20 20 ...   223          DC.B    '                                                                              *',$1B,'[4l',$1B,'E'
  224. 000019F7  2A 20 2A 08 08 08 1B 5B 34 68    224          DC.B    '* *',$08,$08,$08,$1B,'[4h'
  225. 00001A01  20 20 20 20 20 20 20 20 20 ...   225          DC.B    '                                                                          * *',$1B,'[4l',$1B,'E'
  226. 00001A54  2A 2A 08 08 1B 5B 34 68          226          DC.B    '**',$08,$08,$1B,'[4h'
  227. 00001A5C  20 20 20 20 20 20 20 20 20 ...   227          DC.B    '                                                                            **',$1B,'[4l',$1B,'E'
  228. 00001AB0  2A 2A 2A 2A 08 08 08 08 1B ...   228          DC.B    '****',$08,$08,$08,$08,$1B,'[4h'
  229. 00001ABC  20 20 20 20 20 20 20 20 20 ...   229          DC.B    '                                                                        ****',$1B,'[4l',$1B,'E'
  230. 00001B0E  50 72 65 73 73 20 52 45 54 ...   230          DC.B    'Press RETURN to Continue... ',$1B,'[4l',$00,$3D,$1B,'[2J',$00,$00
  231. 00001B36                                   231                                                                                  
  232. 00001B36  48E7 FFFE                        232  LTOA:        MOVEM.L        D0-D7/A0-A6,-(A7)
  233. 00001B3A                                   233  
  234. 00001B3A  113C 0000                        234          MOVE.B        #$00,-(A0)    *APPEND NULL CHARACTER TO OUTPUT STRING
  235. 00001B3E  143C 0000                        235          MOVE.B        #$00,D2        *SET NEGATIVE FLAG TO INDICATE NON NEGATIVE NUMBER FOR NOW
  236. 00001B42  2601                             236          MOVE.L        D1,D3        *MOVE HEX OUTPUT (D1) TO HOLDER (D3)
  237. 00001B44  6A00 0014                        237          BPL        LTOALOOP    *IF POSITIVE THEN GO CONVERT
  238. 00001B48  6600 000A                        238          BNE         LTOA2        *IF ZERO THEN YOUR FINISHED
  239. 00001B4C                                   239  
  240. 00001B4C  113C 0030                        240          MOVE.B        #48,-(A0)
  241. 00001B50  6000 0026                        241          BRA        LTOAEND
  242. 00001B54                                   242  
  243. 00001B54  4483                             243  LTOA2:        NEG.L        D3        *IF NEGATIVE THEN NEGATE
  244. 00001B56  1E3C 00AA                        244          MOVE.B        #$AA,D7        *SET NEGATIVE FLAG
  245. 00001B5A                                   245  
  246. 00001B5A  4EB9 00001BD6                    246  LTOALOOP:    JSR        LDIV        *GO PERFORM LONG DIV BY 10 ON HEX NUMBER
  247. 00001B60  0643 0030                        247          ADD.W        #$30,D3        *ADD $30 TO REMAINDER
  248. 00001B64  1103                             248          MOVE.B        D3,-(A0)    *MOVE LSB TO ASCII CHAR STRING POINTER
  249. 00001B66  2600                             249          MOVE.L        D0,D3        *MOVE RECEIVED QUOTIENT TO D3 TO SEND TO LDIV AGAIN
  250. 00001B68  4A80                             250          TST.L        D0        *IS QUOTIENT EQUAL TO ZERO?
  251. 00001B6A  66EE                             251          BNE        LTOALOOP    *IF NOT THEN KEEP CONVERTING
  252. 00001B6C                                   252  
  253. 00001B6C  0C07 00AA                        253          CMPI.B        #$AA,D7        *WAS NEGATIVE FLAG SET?
  254. 00001B70  6600 0006                        254          BNE        LTOAEND        *NO, GO TO THE END
  255. 00001B74  113C 002D                        255          MOVE.B        #$2D,-(A0)    *YES, APPEND A NEGATIVE SIGN TO ASCII STRING
  256. 00001B78                                   256  
  257. 00001B78                                   257  
  258. 00001B78  4CDF 7FFF                        258  LTOAEND:    MOVEM.L        (A7)+,D0-D7/A0-A6
  259. 00001B7C  4E75                             259          RTS                *RETURN
  260. 00001B7E                                   260  
  261. 00001B7E                                   261  
  262. 00001B7E  48E7 7FFE                        262  ATOL:        MOVEM.L        D1-D7/A0-A6,-(A7)    *SAVE PERTINENT REGISTERS
  263. 00001B82  183C 0000                        263          MOVE.B        #0,D4        *SET NEGATIVE FLAG TO OFF
  264. 00001B86  7000                             264          MOVE.L        #0,D0        *CLEAR RESULT REGISTER
  265. 00001B88  7200                             265          MOVE.L        #0,D1        *CLEAR CHARACTER HOLDER
  266. 00001B8A                                   266  
  267. 00001B8A  1218                             267  ATOLLP1:    MOVE.B        (A0)+,D1    *GET FIRST CHARACTER IN ASCII STRING
  268. 00001B8C  6700 002C                        268          BEQ        ATOLDONE    *IF NULL, THEN YOU'RE FINISHED
  269. 00001B90  227C 00001BCA                    269          MOVE.L        #VALIDSTR,A1    *SET CHARACTER CHECK POINTER
  270. 00001B96                                   270  
  271. 00001B96  0C11 0000                        271  ATOLLP2:    CMP.B        #0,(A1)        *CHECKED FOR ALL VALID CHARACTERS?
  272. 00001B9A  67EE                             272          BEQ        ATOLLP1        *IF YES, GET NEXT CHARACTER IN ASCII STRING
  273. 00001B9C  B23C 002D                        273          CMP.B        #$2D,D1        *IS IT THE NEGATIVE SIGN?
  274. 00001BA0  6700 0012                        274          BEQ        SETNEG        *IF YES, GO SET NEGATIVE FLAG
  275. 00001BA4  B219                             275          CMP.B        (A1)+,D1    *IS THE CHARACTER VALID?
  276. 00001BA6  66EE                             276          BNE        ATOLLP2        *IF NOT, COMPARE TO OTHER VALID CHARACTERS
  277. 00001BA8                                   277          
  278. 00001BA8  C23C 000F                        278          AND.B        #$0F,D1        *MASK UPPER BITS OF ASCII CHARACTER
  279. 00001BAC  C0FC 000A                        279          MULU        #10,D0        *BEGIN CONVERSION TO BASE 10
  280. 00001BB0  D081                             280          ADD.L        D1,D0        *ADD NEXT DIGIT IN STRING TO RESULT
  281. 00001BB2  60D6                             281          BRA        ATOLLP1        *GET NEXT CHARACTER IN ASCII STRING
  282. 00001BB4                                   282  
  283. 00001BB4  183C 00FF                        283  SETNEG:        MOVE.B        #$FF,D4        *SET NEGATIVE FLAG
  284. 00001BB8  60D0                             284          BRA        ATOLLP1        *GET NEXT CHARACTER IN ASCII STRING
  285. 00001BBA                                   285  
  286. 00001BBA  B83C 00FF                        286  ATOLDONE:    CMP.B        #$FF,D4        *WAS IT A NEGATIVE NUMBER?
  287. 00001BBE  6600 0004                        287          BNE        ATOLEND        *NO, SKIP TO END
  288. 00001BC2  4480                             288          NEG.L        D0        *YES, NEGATE THE RESULT
  289. 00001BC4                                   289  
  290. 00001BC4  4CDF 7FFE                        290  ATOLEND:    MOVEM.L        (A7)+,D1-D7/A0-A6    *RECALL PERTINENT REGISTERS
  291. 00001BC8  4E75                             291          RTS                *RETURN RESULT
  292. 00001BCA                                   292  
  293. 00001BCA  31 32 33 34 35 36 37 38 39 ...   293  VALIDSTR:    DC.B        '1234567890',0,0
  294. 00001BD6                                   294  
  295. 00001BD6  2003                             295  LDIV:        MOVE.L        D3,D0        *STORE IN D0 FOR NOW
  296. 00001BD8  4243                             296          CLR.W        D3        *CLEAR LOWER WORD OF DIVIDEND
  297. 00001BDA  4843                             297          SWAP        D3        *MOVE UPPER WORD TO LOWER POSITION
  298. 00001BDC  4840                             298          SWAP        D0        *SWAP THE HOLDER
  299. 00001BDE  86FC 000A                        299          DIVU        #$A,D3        *PERFORM CONVERSION DIVISION
  300. 00001BE2  3003                             300          MOVE.W        D3,D0        *MOVE MSW QUOTIENT TO D0
  301. 00001BE4  4840                             301          SWAP        D0        *SWAP IT INTO MSW POSITION
  302. 00001BE6  3600                             302          MOVE.W        D0,D3        *MOVE LSW INTO DIVIDEND
  303. 00001BE8  86FC 000A                        303          DIVU        #$A,D3        *PERFORM CONVERSION DIVISION
  304. 00001BEC  3003                             304          MOVE.W        D3,D0        *MOVE LSW QUOTIENT TO D0
  305. 00001BEE  4243                             305          CLR.W        D3        *CLEARS LSW QUOTIENT FROM D3
  306. 00001BF0  4843                             306          SWAP         D3        *SWAPS TOTAL REMAINDER TO LSW OF D3
  307. 00001BF2  4E75                             307          RTS                *RETURNS BIG QUOTIENT (D0), REMAINDER (D3)*
  308. 00001BF4                                   308  * Routines to control the Terminal Display
  309. 00001BF4                                   309  *
  310. 00001BF4                                   310  * By: Bradford W. Mott
  311. 00001BF4                                   311  *
  312. 00001BF4                                   312  
  313. 00001BF4                                   313  
  314. 00001BF4  =00000007                        314  BELL_CODE:    EQU    07
  315. 00001BF4                                   315  
  316. 00001BF4                                   316  
  317. 00001BF4                                   317  *
  318. 00001BF4                                   318  * This routine sounds the terminal bell
  319. 00001BF4                                   319  *
  320. 00001BF4                                   320  
  321. 00001BF4  2F00                             321  BELL:    MOVE.L    D0,-(A7)        * Save D0 on stack
  322. 00001BF6  7007                             322      MOVE.L    #BELL_CODE,D0        * Get the BELL character
  323. 00001BF8  4EB8 14D0                        323      JSR    PUTC            * Transmit it to the TERMINAL
  324. 00001BFC  201F                             324      MOVE.L    (A7)+,D0        * Restore D0
  325. 00001BFE  4E75                             325      RTS                * Return to calling procedure
  326. 00001C00                                   326  
  327. 00001C00                                   327  
  328. 00001C00                                   328  *
  329. 00001C00                                   329  * This routine clears the terminal display and homes the cursor
  330. 00001C00                                   330  *
  331. 00001C00                                   331  
  332. 00001C00  48E7 8080                        332  CLEAR:    MOVEM.L    D0/A0,-(A7)        * Save A0&D0 on stack
  333. 00001C04  207C 00001C1C                    333      MOVE.L    #CLRSTR,A0        * Load address of clear screen string
  334. 00001C0A  1018                             334  CLLOOP:    MOVE.B    (A0)+,D0        * Get a character
  335. 00001C0C  6700 0008                        335      BEQ    CLEXT            * EXIT on NULL
  336. 00001C10  4EB8 14D0                        336      JSR    PUTC            * Put character to display
  337. 00001C14  60F4                             337      BRA    CLLOOP            * Loop
  338. 00001C16  4CDF 0101                        338  CLEXT:    MOVEM.L    (A7)+,D0/A0        * Restore A0&D0
  339. 00001C1A  4E75                             339      RTS                * Return to calling procedure
  340. 00001C1C                                   340  
  341. 00001C1C  1B 5B 3B 48 1B 5B 32 4A 00 00    341  CLRSTR:    DC.B 27,'[;H',27,'[2J',0,0    * Clear Screen code for VT100
  342. 00001C26                                   342  
  343. 00001C26                                   343  
  344. 00001C26                                   344  
  345. 00001C26                                   345  *
  346. 00001C26                                   346  * This routine moves the display's cursor to the X/Y coordinates
  347. 00001C26                                   347  * specified in the D0 & D1 registers (X=D0,Y=D1)
  348. 00001C26                                   348  *
  349. 00001C26                                   349  
  350. 00001C26  48E7 FFFE                        350  POSITION:    MOVEM.L    D0-D7/A0-A6,-(A7)    * Save D0-D1 & A0 on stack
  351. 00001C2A                                   351  
  352. 00001C2A  0280 000000FF                    352          ANDI.L    #255,D0        * Clear the unused parts of 
  353. 00001C30  0281 000000FF                    353          ANDI.L    #255,D1        * data register
  354. 00001C36                                   354  
  355. 00001C36  207C 00001CA4                    355          MOVE.L  #POSSTR+2,A0    * Address of row substring
  356. 00001C3C  82FC 000A                        356          DIVU    #10,D1        * Let's convert row number to ASCII
  357. 00001C40  0601 0030                        357          ADDI.B    #48,D1
  358. 00001C44  10C1                             358          MOVE.B    D1,(A0)+    * Put in POSSTR
  359. 00001C46  4841                             359          SWAP    D1
  360. 00001C48  0601 0030                        360          ADDI.B    #48,D1
  361. 00001C4C  1081                             361          MOVE.B    D1,(A0)        * Put in POSSTR
  362. 00001C4E                                   362  
  363. 00001C4E  13FC 0030 00001CA7               363          MOVE.B    #48,POSSTR+5
  364. 00001C56  0C40 0064                        364          CMPI.W    #100,D0
  365. 00001C5A  6D00 000E                        365          BLT    POS2
  366. 00001C5E                                   366  
  367. 00001C5E  0440 0064                        367          SUBI.W    #100,D0
  368. 00001C62  13FC 0031 00001CA7               368          MOVE.B  #49,POSSTR+5
  369. 00001C6A                                   369  
  370. 00001C6A  207C 00001CA8                    370  POS2:        MOVE.L    #POSSTR+6,A0    * Address of col substring
  371. 00001C70  80FC 000A                        371          DIVU    #10,D0        * Let's convert column number to ASCII
  372. 00001C74  0600 0030                        372          ADDI.B    #48,D0
  373. 00001C78  10C0                             373          MOVE.B    D0,(A0)+    * Put in POSSTR
  374. 00001C7A  4840                             374          SWAP    D0
  375. 00001C7C  0600 0030                        375          ADDI.B    #48,D0
  376. 00001C80  1080                             376          MOVE.B    D0,(A0)        * Put in POSSTR
  377. 00001C82                                   377  
  378. 00001C82  207C 00001CA2                    378          MOVE.L    #POSSTR,A0    * Get addr of POSITION string
  379. 00001C88  1018                             379  POSLOOP:    MOVE.B    (A0)+,D0    * Get a character
  380. 00001C8A  6700 0008                        380          BEQ    POSEXT        * Exit on NULL
  381. 00001C8E  4EB8 14D0                        381          JSR     PUTC        * Send to the terminal
  382. 00001C92  60F4                             382          BRA    POSLOOP        * Loop
  383. 00001C94                                   383      
  384. 00001C94  4CDF 7FFF                        384  POSEXT:        MOVEM.L    (A7)+,D0-D7/A0-A6    * Restore registers
  385. 00001C98  4E75                             385          RTS            * Return to calling procedure
  386. 00001C9A                                   386  
  387. 00001C9A  0000 0000 0000 0000              387          DC.W    0,0,0,0
  388. 00001CA2  1B 5B 30 30 3B 30 30 30 3B ...   388  POSSTR:     DC.B 27,'[00;000;H',0        * Position Cursor code for VT100
  389. 00001CAE  0000 0000 0000 0000              389          DC.W    0,0,0,0
  390. 00001CB6                                   390  
  391. 00001CB6                                   391  
  392. 00001CB6                                   392  
  393. 00001CB6                                   393  
  394. 00001CB6                                   394  
  395. 00001CB6                                   395  *
  396. 00001CB6                                   396  * This routine gets the sizes of the two matrices to multiply
  397. 00001CB6                                   397  *
  398. 00001CB6                                   398  
  399. 00001CB6  48E7 FFFE                        399  GETSIZE:    MOVEM.L    D0-D7/A0-A6,-(SP)
  400. 00001CBA                                   400  
  401. 00001CBA  4EB8 1C00                        401          JSR CLEAR
  402. 00001CBE                                   402  
  403. 00001CBE  207C 00001E20                    403          MOVE.L    #GS_TIT,A0        Print title
  404. 00001CC4  4EB8 1502                        404          JSR    PRINT
  405. 00001CC8                                   405  
  406. 00001CC8                                   406  
  407. 00001CC8  207C 00001E7C                    407  GS_GAC:        MOVE.L    #GS_CA,A0
  408. 00001CCE  4EB8 1502                        408          JSR    PRINT
  409. 00001CD2                                   409  
  410. 00001CD2  227C 00001EDE                    410          MOVE.L    #GS_VALID,A1        Get number of columns
  411. 00001CD8  207C 00001EEA                    411          MOVE.L    #GS_BUFFER,A0
  412. 00001CDE  303C 0002                        412          MOVE.W    #2,D0
  413. 00001CE2  4EB8 1430                        413          JSR    INPUT
  414. 00001CE6                                   414  
  415. 00001CE6  207C 00001EEA                    415          MOVE.L    #GS_BUFFER,A0
  416. 00001CEC  4EB8 1B7E                        416          JSR    ATOL
  417. 00001CF0  31C0 10D6                        417          MOVE.W    D0,MA_C
  418. 00001CF4                                   418  
  419. 00001CF4  0C40 000A                        419          CMPI.W    #10,D0
  420. 00001CF8  6E00 000E                        420          BGT    GS_ACA
  421. 00001CFC  0C40 0001                        421          CMPI.W    #1,D0
  422. 00001D00  6D00 0006                        422          BLT    GS_ACA
  423. 00001D04  6000 0010                        423          BRA    GS_GAR
  424. 00001D08                                   424  
  425. 00001D08  207C 00001EF0                    425  GS_ACA:        MOVE.L    #GS_ERROR,A0
  426. 00001D0E  4EB8 1502                        426          JSR    PRINT
  427. 00001D12  4EF8 1CC8                        427          JMP    GS_GAC
  428. 00001D16                                   428  
  429. 00001D16                                   429  
  430. 00001D16                                   430  
  431. 00001D16  207C 00001E94                    431  GS_GAR:        MOVE.L    #GS_RA,A0
  432. 00001D1C  4EB8 1502                        432          JSR    PRINT
  433. 00001D20                                   433  
  434. 00001D20  227C 00001EDE                    434          MOVE.L    #GS_VALID,A1        Get number of columns
  435. 00001D26  207C 00001EEA                    435          MOVE.L    #GS_BUFFER,A0
  436. 00001D2C  303C 0002                        436          MOVE.W    #2,D0
  437. 00001D30  4EB8 1430                        437          JSR    INPUT
  438. 00001D34                                   438  
  439. 00001D34  207C 00001EEA                    439          MOVE.L    #GS_BUFFER,A0
  440. 00001D3A  4EB8 1B7E                        440          JSR    ATOL
  441. 00001D3E  31C0 10D4                        441          MOVE.W    D0,MA_R
  442. 00001D42                                   442  
  443. 00001D42  0C40 000A                        443          CMPI.W    #10,D0
  444. 00001D46  6E00 000E                        444          BGT    GS_ARA
  445. 00001D4A  0C40 0001                        445          CMPI.W    #1,D0
  446. 00001D4E  6D00 0006                        446          BLT    GS_ARA
  447. 00001D52  6000 0010                        447          BRA    GS_GBC
  448. 00001D56                                   448  
  449. 00001D56  207C 00001EF0                    449  GS_ARA:        MOVE.L    #GS_ERROR,A0
  450. 00001D5C  4EB8 1502                        450          JSR    PRINT
  451. 00001D60  4EF8 1D16                        451          JMP    GS_GAR
  452. 00001D64                                   452  
  453. 00001D64                                   453  
  454. 00001D64                                   454  
  455. 00001D64  207C 00001EAC                    455  GS_GBC:        MOVE.L    #GS_CB,A0
  456. 00001D6A  4EB8 1502                        456          JSR     PRINT
  457. 00001D6E                                   457  
  458. 00001D6E  227C 00001EDE                    458          MOVE.L    #GS_VALID,A1        Get number of columns
  459. 00001D74  207C 00001EEA                    459          MOVE.L    #GS_BUFFER,A0
  460. 00001D7A  303C 0002                        460          MOVE.W    #2,D0
  461. 00001D7E  4EB8 1430                        461          JSR    INPUT
  462. 00001D82                                   462  
  463. 00001D82  207C 00001EEA                    463          MOVE.L    #GS_BUFFER,A0
  464. 00001D88  4EB8 1B7E                        464          JSR    ATOL
  465. 00001D8C  31C0 10DA                        465          MOVE.W    D0,MB_C
  466. 00001D90                                   466  
  467. 00001D90  0C40 000A                        467          CMPI.W    #10,D0
  468. 00001D94  6E00 000E                        468          BGT    GS_BCA
  469. 00001D98  0C40 0001                        469          CMPI.W    #1,D0
  470. 00001D9C  6D00 0006                        470          BLT    GS_BCA
  471. 00001DA0  6000 0010                        471          BRA    GS_GBR
  472. 00001DA4                                   472  
  473. 00001DA4  207C 00001EF0                    473  GS_BCA:        MOVE.L    #GS_ERROR,A0
  474. 00001DAA  4EB8 1502                        474          JSR    PRINT
  475. 00001DAE  4EF8 1D64                        475          JMP    GS_GBC
  476. 00001DB2                                   476  
  477. 00001DB2                                   477  
  478. 00001DB2                                   478  
  479. 00001DB2  207C 00001EC6                    479  GS_GBR:        MOVE.L    #GS_RB,A0
  480. 00001DB8  4EB8 1502                        480          JSR     PRINT
  481. 00001DBC                                   481  
  482. 00001DBC  227C 00001EDE                    482          MOVE.L    #GS_VALID,A1        Get number of columns
  483. 00001DC2  207C 00001EEA                    483          MOVE.L    #GS_BUFFER,A0
  484. 00001DC8  303C 0002                        484          MOVE.W    #2,D0
  485. 00001DCC  4EB8 1430                        485          JSR    INPUT
  486. 00001DD0                                   486  
  487. 00001DD0  207C 00001EEA                    487          MOVE.L    #GS_BUFFER,A0
  488. 00001DD6  4EB8 1B7E                        488          JSR    ATOL
  489. 00001DDA  31C0 10D8                        489          MOVE.W    D0,MB_R
  490. 00001DDE                                   490  
  491. 00001DDE  0C40 000A                        491          CMPI.W    #10,D0
  492. 00001DE2  6E00 000E                        492          BGT    GS_BRA
  493. 00001DE6  0C40 0001                        493          CMPI.W    #1,D0
  494. 00001DEA  6D00 0006                        494          BLT    GS_BRA
  495. 00001DEE  6000 0010                        495          BRA    GS_TEST
  496. 00001DF2                                   496  
  497. 00001DF2  207C 00001EF0                    497  GS_BRA:        MOVE.L    #GS_ERROR,A0
  498. 00001DF8  4EB8 1502                        498          JSR    PRINT
  499. 00001DFC  4EF8 1DB2                        499          JMP    GS_GBR
  500. 00001E00                                   500  
  501. 00001E00                                   501  
  502. 00001E00  3038 10D6                        502  GS_TEST:    MOVE.W    MA_C,D0
  503. 00001E04  B078 10D8                        503          CMP.W    MB_R,D0
  504. 00001E08  6700 0010                        504          BEQ    GS_OK
  505. 00001E0C                                   505  
  506. 00001E0C  207C 00001F02                    506          MOVE.L    #GS_BERR,A0
  507. 00001E12  4EB8 1502                        507          JSR    PRINT
  508. 00001E16  4EF8 1CC8                        508          JMP    GS_GAC
  509. 00001E1A                                   509  
  510. 00001E1A  4CDF 7FFF                        510  GS_OK:        MOVEM.L    (A7)+,D0-D7/A0-A6
  511. 00001E1E  4E75                             511          RTS
  512. 00001E20                                   512  
  513. 00001E20                                   513  
  514. 00001E20  20 4D 61 74 72 69 78 20 4D ...   514  GS_TIT:        DC.B    ' Matrix Multiply ',10
  515. 00001E32  2D 2D 2D 2D 2D 2D 2D 2D 2D ...   515          DC.B    '-----------------',10,10
  516. 00001E45  50 6C 65 61 73 65 20 65 6E ...   516          DC.B    'Please enter the sizes of the matrices to multiply.',10,10,0,0
  517. 00001E7C                                   517  
  518. 00001E7C  0A 43 6F 6C 75 6D 6E 73 20 ...   518  GS_CA:        DC.B    10,'Columns in matrix A : ',0
  519. 00001E94  0A 52 6F 77 73 20 69 6E 20 ...   519  GS_RA:        DC.B    10,'Rows in matrix A    : ',0
  520. 00001EAC  0A 0A 43 6F 6C 75 6D 6E 73 ...   520  GS_CB:        DC.B    10,10,'Columns in matrix B : ',0,0
  521. 00001EC6  0A 52 6F 77 73 20 69 6E 20 ...   521  GS_RB:        DC.B    10,'Rows in matrix B    : ',0
  522. 00001EDE                                   522  
  523. 00001EDE  30 31 32 33 34 35 36 37 38 ...   523  GS_VALID:    DC.B    '0123456789',0,0
  524. 00001EEA  00 00 00 00 00 00                524  GS_BUFFER:    DC.B    0,0,0,0,0,0
  525. 00001EF0                                   525  
  526. 00001EF0  0A 49 6E 76 61 6C 69 64 20 ...   526  GS_ERROR:    DC.B    10,'Invalid size!!!',10,0    
  527. 00001F02  0A 4D 61 74 72 69 78 20 73 ...   527  GS_BERR:    DC.B    10,'Matrix sizes incompatible!!!!!',10,0,0
  528. 00001F24                                   528  *
  529. 00001F24                                   529  * This routine multiplies two matrices and stores the resulting
  530. 00001F24                                   530  * matrix. ( C=AB )
  531. 00001F24                                   531  *
  532. 00001F24                                   532  * A0 = Matrix A
  533. 00001F24                                   533  * A1 = Matrix B
  534. 00001F24                                   534  * A2 = Matrix C
  535. 00001F24                                   535  *
  536. 00001F24                                   536  * D0 = Matrix A number of rows (i)
  537. 00001F24                                   537  * D1 = Matrix A number of columns
  538. 00001F24                                   538  * D2 = Matrix B number of rows
  539. 00001F24                                   539  * D3 = Matrix B number of columns (j)
  540. 00001F24                                   540  *
  541. 00001F24                                   541  
  542. 00001F24                                   542  MATMULT:
  543. 00001F24  48E7 FFFE                        543      MOVEM.L    D0-D7/A0-A6,-(A7)
  544. 00001F28                                   544  
  545. 00001F28  33C3 00001FA0                    545      MOVE.W    D3,B_COLS        Save Columns in C
  546. 00001F2E                                   546  
  547. 00001F2E  3639 00001FA0                    547  I_LOOP:    MOVE.W    B_COLS,D3
  548. 00001F34  5340                             548      SUBI.W    #1,D0
  549. 00001F36  6B00 005E                        549      BMI    MATFIN
  550. 00001F3A                                   550  
  551. 00001F3A  23FC 00000000 00001F9C           551  J_LOOP:    MOVE.L    #0,SUM
  552. 00001F44  3801                             552      MOVE.W    D1,D4        T Counter
  553. 00001F46  5344                             553      SUBI.W    #1,D4
  554. 00001F48                                   554  
  555. 00001F48  5343                             555      SUB.W    #1,D3
  556. 00001F4A  6BE2                             556      BMI    I_LOOP
  557. 00001F4C                                   557  
  558. 00001F4C  3A01                             558  T_LOOP:    MOVE.W    D1,D5        Num Columns in A
  559. 00001F4E  CAC0                             559      MULU    D0,D5        I * Columns in A
  560. 00001F50  DA44                             560      ADD.W    D4,D5        + T
  561. 00001F52  CAFC 0002                        561      MULU    #2,D5        Words
  562. 00001F56  7C00                             562      MOVEQ    #0,D6
  563. 00001F58  3C30 5000                        563      MOVE.W    (A0,D5),D6    Get A(i,t)
  564. 00001F5C                                   564  
  565. 00001F5C  3A39 00001FA0                    565      MOVE.W    B_COLS,D5        Num Columns in B
  566. 00001F62  CAC4                             566      MULU    D4,D5        T * Columns in B
  567. 00001F64  DA43                             567      ADD.W    D3,D5        + J
  568. 00001F66  CAFC 0002                        568      MULU    #2,D5
  569. 00001F6A  7E00                             569      MOVEQ    #0,D7
  570. 00001F6C  3E31 5000                        570      MOVE.W    (A1,D5),D7    Get B(t,j)
  571. 00001F70                                   571  
  572. 00001F70  CFC6                             572      MULS    D6,D7        A(i,t)*B(t,j)
  573. 00001F72  DFB9 00001F9C                    573      ADD.L    D7,SUM        add to running Sum
  574. 00001F78                                   574  
  575. 00001F78  5344                             575      SUBI.W    #1,D4
  576. 00001F7A  6AD0                             576      BPL    T_LOOP
  577. 00001F7C                                   577  
  578. 00001F7C  3A39 00001FA0                    578      MOVE.W    B_COLS,D5    Num Columns in C
  579. 00001F82  CAC0                             579      MULU    D0,D5        I * Num Columns in C
  580. 00001F84  DA43                             580      ADD.W    D3,D5        + J
  581. 00001F86  CAFC 0004                        581      MULU    #4,D5
  582. 00001F8A  25B9 00001F9C 5000               582      MOVE.L    SUM,(A2,D5)    Store C(i,j)
  583. 00001F92                                   583  
  584. 00001F92  60A6                             584      BRA    J_LOOP
  585. 00001F94  6098                             585      BRA    I_LOOP
  586. 00001F96                                   586  
  587. 00001F96  4CDF 7FFF                        587  MATFIN:    MOVEM.L    (A7)+,D0-D7/A0-A6
  588. 00001F9A  4E75                             588      RTS
  589. 00001F9C                                   589  
  590. 00001F9C                                   590  
  591. 00001F9C  00000001                         591  SUM:    DC.L    $1
  592. 00001FA0  0001                             592  B_COLS:    DC.W    $1
  593. 00001FA2                                   593  *
  594. 00001FA2                                   594  *     MATOUT
  595. 00001FA2                                   595  **
  596. 00001FA2                                   596  * D0 contains the number of columns
  597. 00001FA2                                   597  * D1 contains the number of rows
  598. 00001FA2                                   598  *
  599. 00001FA2                                   599  * A0 contains a pointer to a buffer to store matrix elements in
  600. 00001FA2                                   600  * A1 contains a pointer to the a title string
  601. 00001FA2                                   601  *
  602. 00001FA2                                   602  * By: Bradford W. Mott
  603. 00001FA2                                   603  *
  604. 00001FA2                                   604  
  605. 00001FA2                                   605  
  606. 00001FA2  48E7 FFFE                        606  MATOUT:        MOVEM.L    A0-A6/D0-D7,-(A7)    Save registers on stack
  607. 00001FA6                                   607  
  608. 00001FA6  23C8 00002196                    608          MOVE.L    A0,MO_DATA        Store buffer address
  609. 00001FAC  33C0 0000219A                    609          MOVE.W    D0,MO_ROW        Store num of rows
  610. 00001FB2  33C1 0000219C                    610          MOVE.W    D1,MO_COL        Store num of columns
  611. 00001FB8                                   611  
  612. 00001FB8                                   612  
  613. 00001FB8  4EB8 1C00                        613          JSR    CLEAR            Clear the display
  614. 00001FBC                                   614  
  615. 00001FBC  207C 0000219E                    615          MOVE.L    #MO_32ON,A0        Turn 132 mode on
  616. 00001FC2  4EB8 1502                        616          JSR    PRINT
  617. 00001FC6                                   617  
  618. 00001FC6  303C 0039                        618          MOVE.W    #57,D0            X position of cursor
  619. 00001FCA  323C 0002                        619          MOVE.W    #2,D1            Y position of cursor
  620. 00001FCE  4EB8 1C26                        620          JSR    POSITION        Position the Cursor
  621. 00001FD2                                   621  
  622. 00001FD2  2049                             622          MOVE.L    A1,A0            Print the Title String
  623. 00001FD4  4EB8 1502                        623          JSR    PRINT
  624. 00001FD8                                   624  
  625. 00001FD8                                   625  
  626. 00001FD8  207C 0000217E                    626          MOVE.L    #MO_Y,A0        Pointer to Y position array
  627. 00001FDE  7000                             627          MOVEQ    #0,D0            Clear LCV (Loop Control Var)
  628. 00001FE0                                   628  
  629. 00001FE0  323C 0014                        629  MO_L1:        MOVE.W    #20,D1            Calculate Y position
  630. 00001FE4  9279 0000219A                    630          SUB.W    MO_ROW,D1
  631. 00001FEA  82FC 0002                        631          DIVU    #2,D1
  632. 00001FEE  D240                             632          ADD.W    D0,D1            (20-row)/2+counter
  633. 00001FF0  1181 0000                        633          MOVE.B    D1,0(A0,D0)        Store in array
  634. 00001FF4                                   634  
  635. 00001FF4  5240                             635          ADDQ.W    #1,D0
  636. 00001FF6  B079 0000219A                    636          CMP.W    MO_ROW,D0
  637. 00001FFC  66E2                             637          BNE    MO_L1
  638. 00001FFE                                   638  
  639. 00001FFE                                   639  
  640. 00001FFE  207C 0000218A                    640          MOVE.L    #MO_X,A0        Pointer to X position array
  641. 00002004  7000                             641          MOVEQ    #0,D0            Clear LCV (Loop Control Var)
  642. 00002006                                   642  
  643. 00002006  323C 0084                        643  MO_L2:        MOVE.W    #132,D1            Calculate X position
  644. 0000200A  3439 0000219C                    644          MOVE.W  MO_COL,D2
  645. 00002010  C4FC 000A                        645          MULU    #10,D2
  646. 00002014  9242                             646          SUB.W    D2,D1
  647. 00002016  82FC 0002                        647          DIVU    #2,D1
  648. 0000201A  3400                             648          MOVE.W    D0,D2
  649. 0000201C  C4FC 000A                        649          MULU    #10,D2
  650. 00002020  D242                             650          ADD.W    D2,D1            (132-col*10)/2+counter*10
  651. 00002022  1181 0000                        651          MOVE.B    D1,0(A0,D0)        Store in array
  652. 00002026                                   652  
  653. 00002026  5240                             653          ADDQ.W    #1,D0
  654. 00002028  B079 0000219C                    654          CMP.W    MO_COL,D0
  655. 0000202E  66D6                             655          BNE    MO_L2
  656. 00002030                                   656  
  657. 00002030                                   657  
  658. 00002030                                   658  * Draw the Matrix outline
  659. 00002030                                   659  
  660. 00002030  207C 0000217E                    660          MOVE.L    #MO_Y,A0        Pointer to Y position array
  661. 00002036  7E00                             661          MOVEQ    #0,D7            Clear LCV (Loop Control Var)
  662. 00002038                                   662  
  663. 00002038  303C 0084                        663  MO_L3:        MOVE.W    #132,D0            Calculate X position
  664. 0000203C  3239 0000219C                    664          MOVE.W    MO_COL,D1
  665. 00002042  C2FC 000A                        665          MULU    #10,D1
  666. 00002046  9041                             666          SUB.W    D1,D0
  667. 00002048  80FC 0002                        667          DIVU    #2,D0
  668. 0000204C  5540                             668          SUBI.W    #2,D0            D0=(132-col*10)/2-2
  669. 0000204E                                   669  
  670. 0000204E  1230 7000                        670          MOVE.B    0(A0,D7),D1        Get Y Position
  671. 00002052                                   671  
  672. 00002052  4EB8 1C26                        672          JSR    POSITION        Position Cursor
  673. 00002056  103C 007C                        673          MOVE.B    #$7C,D0            the "|" character
  674. 0000205A  4EB8 14D0                        674          JSR    PUTC
  675. 0000205E                                   675  
  676. 0000205E                                   676  
  677. 0000205E  303C 0084                        677          MOVE.W    #132,D0            Calculate X position
  678. 00002062  3239 0000219C                    678          MOVE.W    MO_COL,D1
  679. 00002068  C2FC 000A                        679          MULU    #10,D1
  680. 0000206C  9041                             680          SUB.W    D1,D0
  681. 0000206E  80FC 0002                        681          DIVU    #2,D0
  682. 00002072  D041                             682          ADD.W    D1,D0            D0=(132-col*10)/2+col*10
  683. 00002074                                   683  
  684. 00002074  1230 7000                        684          MOVE.B    0(A0,D7),D1        Get Y Position
  685. 00002078                                   685  
  686. 00002078  4EB8 1C26                        686          JSR    POSITION        Position Cursor
  687. 0000207C  103C 007C                        687          MOVE.B    #$7C,D0            the "|" character
  688. 00002080  4EB8 14D0                        688          JSR    PUTC
  689. 00002084                                   689  
  690. 00002084  5247                             690          ADDQ.W    #1,D7
  691. 00002086  BE79 0000219A                    691          CMP.W    MO_ROW,D7
  692. 0000208C  66AA                             692          BNE    MO_L3
  693. 0000208E                                   693  
  694. 0000208E                                   694  * Get the data for each element.
  695. 0000208E                                   695  
  696. 0000208E  7E00                             696          MOVEQ    #0,D7            LCV for row
  697. 00002090  267C 0000218A                    697          MOVE.L    #MO_X,A3
  698. 00002096  287C 0000217E                    698          MOVE.L    #MO_Y,A4
  699. 0000209C                                   699  
  700. 0000209C  7C00                             700  MO_L4:        MOVEQ    #0,D6            LCV for column
  701. 0000209E                                   701  
  702. 0000209E  1033 6000                        702  MO_L5:        MOVE.B    0(A3,D6),D0
  703. 000020A2  1234 7000                        703          MOVE.B    0(A4,D7),D1
  704. 000020A6  4EB8 1C26                        704          JSR    POSITION
  705. 000020AA                                   705  
  706. 000020AA                                   706  
  707. 000020AA  23FC 20202020 0000213E           707          MOVE.L    #$20202020,MO_OUT      Set output to all spaces
  708. 000020B4  23FC 20202020 00002142           708          MOVE.L    #$20202020,MO_OUT+4
  709. 000020BE  23FC 20200000 00002146           709          MOVE.L    #$20200000,MO_OUT+8
  710. 000020C8                                   710  
  711. 000020C8  2079 00002196                    711          MOVE.L    MO_DATA,A0
  712. 000020CE  3039 0000219C                    712          MOVE.W    MO_COL,D0
  713. 000020D4  C0C7                             713          MULU    D7,D0            D0=row*col
  714. 000020D6  C0FC 0004                        714          MULU    #4,D0            *4
  715. 000020DA                                   715  
  716. 000020DA  3206                             716          MOVE.W    D6,D1
  717. 000020DC  C2FC 0004                        717          MULU    #4,D1
  718. 000020E0  D041                             718          ADD.W    D1,D0
  719. 000020E2                                   719  
  720. 000020E2  2230 0000                        720          MOVE.L    0(A0,D0),D1        Store entry in Matrix Buffer
  721. 000020E6                                   721  
  722. 000020E6  207C 00002148                    722          MOVE.L    #MO_OUT+10,A0
  723. 000020EC  4EB8 1B36                        723          JSR    LTOA
  724. 000020F0                                   724  
  725. 000020F0  207C 0000213E                    725          MOVE.L    #MO_OUT,A0
  726. 000020F6  4EB8 1502                        726          JSR    PRINT
  727. 000020FA                                   727  
  728. 000020FA  5246                             728          ADDQ.W    #1,D6
  729. 000020FC  BC79 0000219C                    729          CMP.W    MO_COL,D6
  730. 00002102  669A                             730          BNE    MO_L5
  731. 00002104                                   731  
  732. 00002104  5247                             732          ADDQ.W    #1,D7
  733. 00002106  BE79 0000219A                    733          CMP.W    MO_ROW,D7
  734. 0000210C  668E                             734          BNE    MO_L4
  735. 0000210E                                   735  
  736. 0000210E                                   736  
  737. 0000210E                                   737  * PRINT PROMPT
  738. 0000210E  303C 0000                        738          MOVE.W    #0,D0
  739. 00002112  323C 0016                        739          MOVE.W    #22,D1
  740. 00002116  4EB8 1C26                        740          JSR    POSITION
  741. 0000211A  207C 00002152                    741          MOVE.L    #MO_PROMPT,A0
  742. 00002120  4EB8 1502                        742          JSR    PRINT
  743. 00002124                                   743  
  744. 00002124  4EB8 14F0                        744  MO_LKEY:    JSR    GETC
  745. 00002128  0C00 000D                        745          CMPI.B    #13,D0
  746. 0000212C  66F6                             746          BNE    MO_LKEY    
  747. 0000212E                                   747  
  748. 0000212E                                   748  * Go back to 80 column mode
  749. 0000212E  207C 000021A4                    749          MOVE.L    #MO_32OFF,A0
  750. 00002134  4EB8 1502                        750          JSR    PRINT
  751. 00002138                                   751  
  752. 00002138                                   752  * Return to calling routine
  753. 00002138                                   753  
  754. 00002138  4CDF 7FFF                        754          MOVEM.L    (A7)+,A0-A6/D0-D7    Restore Registers
  755. 0000213C                                   755  
  756. 0000213C  4E75                             756          RTS                Return to caller
  757. 0000213E                                   757  
  758. 0000213E                                   758  
  759. 0000213E  2D 31 30 30 30 00 00 00 00 ...   759  MO_OUT:         DC.B    '-1000',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  760. 00002152  50 72 65 73 73 20 52 65 74 ...   760  MO_PROMPT:      DC.B    'Press Return Key...',0
  761. 00002166  1B 5B 30 6D 00 00                761  MO_HOFF:        DC.B    27,'[0m',0,0
  762. 0000216C  1B 5B 32 30 3B 32 33 72 00 00    762  MO_SSR:         DC.B    27,'[20;23r',0,0
  763. 00002176  1B 5B 30 3B 32 34 72 00          763  MO_SRR:         DC.B    27,'[0;24r',0
  764. 0000217E  00 00 00 00 00 00 00 00 00 ...   764  MO_Y:           DC.B    0,0,0,0,0,0,0,0,0,0,0,0
  765. 0000218A  00 00 00 00 00 00 00 00 00 ...   765  MO_X:           DC.B    0,0,0,0,0,0,0,0,0,0,0,0
  766. 00002196  00000000                         766  MO_DATA:        DC.L    0
  767. 0000219A  0000                             767  MO_ROW:         DC.W    0
  768. 0000219C  0000                             768  MO_COL:         DC.W    0
  769. 0000219E  1B 5B 3F 33 68 00                769  MO_32ON:    DC.B    27,'[?3h',0
  770. 000021A4  1B 5B 3F 33 6C 00                770  MO_32OFF:    DC.B    27,'[?3l',0
  771. 000021AA                                   771  
  772. 000021AA                                   772  
  773. 000021AA                                   773  *
  774. 000021AA                                   774  *     MATIN
  775. 000021AA                                   775  *
  776. 000021AA                                   776  * This routine allows the user to enter the elements of a matrix
  777. 000021AA                                   777  *
  778. 000021AA                                   778  * D0 contains the number of columns
  779. 000021AA                                   779  * D1 contains the number of rows
  780. 000021AA                                   780  *
  781. 000021AA                                   781  * A0 contains a pointer to a buffer to store matrix elements in
  782. 000021AA                                   782  * A1 contains a pointer to the a title string
  783. 000021AA                                   783  *
  784. 000021AA                                   784  * By: Bradford W. Mott
  785. 000021AA                                   785  *
  786. 000021AA                                   786  
  787. 000021AA                                   787  
  788. 000021AA  48E7 FFFE                        788  MATIN:        MOVEM.L    A0-A6/D0-D7,-(A7)    Save registers on stack
  789. 000021AE                                   789  
  790. 000021AE  23C8 00002460                    790          MOVE.L    A0,MI_DATA        Store buffer address
  791. 000021B4  33C0 00002464                    791          MOVE.W    D0,MI_ROW        Store num of rows
  792. 000021BA  33C1 00002466                    792          MOVE.W    D1,MI_COL        Store num of columns
  793. 000021C0                                   793  
  794. 000021C0  4EB8 1C00                        794          JSR    CLEAR            Clear the display
  795. 000021C4                                   795  
  796. 000021C4  303C 0021                        796          MOVE.W    #33,D0            X position of cursor
  797. 000021C8  323C 0002                        797          MOVE.W    #2,D1            Y position of cursor
  798. 000021CC  4EB8 1C26                        798          JSR    POSITION        Position the Cursor
  799. 000021D0                                   799  
  800. 000021D0  2049                             800          MOVE.L    A1,A0            Print the Title String
  801. 000021D2  4EB8 1502                        801          JSR    PRINT
  802. 000021D6                                   802  
  803. 000021D6                                   803  
  804. 000021D6  207C 00002447                    804          MOVE.L    #MI_Y,A0        Pointer to Y position array
  805. 000021DC  7000                             805          MOVEQ    #0,D0            Clear LCV (Loop Control Var)
  806. 000021DE                                   806  
  807. 000021DE  323C 0014                        807  MI_L1:        MOVE.W    #20,D1            Calculate Y position
  808. 000021E2  9279 00002464                    808          SUB.W    MI_ROW,D1
  809. 000021E8  82FC 0002                        809          DIVU    #2,D1
  810. 000021EC  D240                             810          ADD.W    D0,D1            (20-row)/2+counter
  811. 000021EE  1181 0000                        811          MOVE.B    D1,0(A0,D0)        Store in array
  812. 000021F2                                   812  
  813. 000021F2  5240                             813          ADDQ.W    #1,D0
  814. 000021F4  B079 00002464                    814          CMP.W    MI_ROW,D0
  815. 000021FA  66E2                             815          BNE    MI_L1
  816. 000021FC                                   816  
  817. 000021FC                                   817  
  818. 000021FC  207C 00002453                    818          MOVE.L    #MI_X,A0        Pointer to X position array
  819. 00002202  7000                             819          MOVEQ    #0,D0            Clear LCV (Loop Control Var)
  820. 00002204                                   820  
  821. 00002204  323C 0050                        821  MI_L2:        MOVE.W    #80,D1            Calculate X position
  822. 00002208  3439 00002466                    822          MOVE.W  MI_COL,D2
  823. 0000220E  C4FC 0006                        823          MULU    #6,D2
  824. 00002212  9242                             824          SUB.W    D2,D1
  825. 00002214  82FC 0002                        825          DIVU    #2,D1
  826. 00002218  3400                             826          MOVE.W    D0,D2
  827. 0000221A  C4FC 0006                        827          MULU    #6,D2
  828. 0000221E  D242                             828          ADD.W    D2,D1            (80-col*6)/2+counter*6
  829. 00002220  1181 0000                        829          MOVE.B    D1,0(A0,D0)        Store in array
  830. 00002224                                   830  
  831. 00002224  5240                             831          ADDQ.W    #1,D0
  832. 00002226  B079 00002466                    832          CMP.W    MI_COL,D0
  833. 0000222C  66D6                             833          BNE    MI_L2
  834. 0000222E                                   834  
  835. 0000222E                                   835  
  836. 0000222E                                   836  * Draw the Matrix outline
  837. 0000222E                                   837  
  838. 0000222E  207C 00002447                    838          MOVE.L    #MI_Y,A0        Pointer to Y position array
  839. 00002234  7E00                             839          MOVEQ    #0,D7            Clear LCV (Loop Control Var)
  840. 00002236                                   840  
  841. 00002236  303C 0050                        841  MI_L3:        MOVE.W    #80,D0            Calculate X position
  842. 0000223A  3239 00002466                    842          MOVE.W    MI_COL,D1
  843. 00002240  C2FC 0006                        843          MULU    #6,D1
  844. 00002244  9041                             844          SUB.W    D1,D0
  845. 00002246  80FC 0002                        845          DIVU    #2,D0
  846. 0000224A  5540                             846          SUBI.W    #2,D0            D0=(80-col*6)/2-2
  847. 0000224C                                   847  
  848. 0000224C  1230 7000                        848          MOVE.B    0(A0,D7),D1        Get Y Position
  849. 00002250                                   849  
  850. 00002250  4EB8 1C26                        850          JSR    POSITION        Position Cursor
  851. 00002254  103C 007C                        851          MOVE.B    #$7C,D0            the "|" character
  852. 00002258  4EB8 14D0                        852          JSR    PUTC
  853. 0000225C                                   853  
  854. 0000225C                                   854  
  855. 0000225C  303C 0050                        855          MOVE.W    #80,D0            Calculate X position
  856. 00002260  3239 00002466                    856          MOVE.W    MI_COL,D1
  857. 00002266  C2FC 0006                        857          MULU    #6,D1
  858. 0000226A  9041                             858          SUB.W    D1,D0
  859. 0000226C  80FC 0002                        859          DIVU    #2,D0
  860. 00002270  D041                             860          ADD.W    D1,D0            D0=(80-col*6)/2+col*6
  861. 00002272                                   861  
  862. 00002272  1230 7000                        862          MOVE.B    0(A0,D7),D1        Get Y Position
  863. 00002276                                   863  
  864. 00002276  4EB8 1C26                        864          JSR    POSITION        Position Cursor
  865. 0000227A  103C 007C                        865          MOVE.B    #$7C,D0            the "|" character
  866. 0000227E  4EB8 14D0                        866          JSR    PUTC
  867. 00002282                                   867  
  868. 00002282  5247                             868          ADDQ.W    #1,D7
  869. 00002284  BE79 00002464                    869          CMP.W    MI_ROW,D7
  870. 0000228A  66AA                             870          BNE    MI_L3
  871. 0000228C                                   871  
  872. 0000228C                                   872  
  873. 0000228C                                   873  
  874. 0000228C                                   874  * Set the Display scrolling region
  875. 0000228C                                   875  
  876. 0000228C  207C 00002435                    876          MOVE.L    #MI_SSR,A0        Addr of string
  877. 00002292  4EB8 1502                        877          JSR    PRINT
  878. 00002296                                   878  
  879. 00002296                                   879  
  880. 00002296                                   880  * Get the data for each element.
  881. 00002296                                   881  
  882. 00002296  7E00                             882          MOVEQ    #0,D7            LCV for row
  883. 00002298  267C 00002453                    883          MOVE.L    #MI_X,A3
  884. 0000229E  287C 00002447                    884          MOVE.L    #MI_Y,A4
  885. 000022A4                                   885  
  886. 000022A4  7C00                             886  MI_L4:        MOVEQ    #0,D6            LCV for column
  887. 000022A6                                   887  
  888. 000022A6  1033 6000                        888  MI_L5:        MOVE.B    0(A3,D6),D0
  889. 000022AA  1234 7000                        889          MOVE.B    0(A4,D7),D1
  890. 000022AE  4EB8 1C26                        890          JSR    POSITION
  891. 000022B2                                   891  
  892. 000022B2  207C 00002427                    892          MOVE.L    #MI_HON,A0        Turn Highlight on
  893. 000022B8  4EB8 1502                        893          JSR    PRINT
  894. 000022BC                                   894  
  895. 000022BC  207C 00002420                    895          MOVE.L    #MI_SPACE,A0        Print Space
  896. 000022C2  4EB8 1502                        896          JSR    PRINT
  897. 000022C6                                   897  
  898. 000022C6  207C 0000242F                    898          MOVE.L    #MI_HOFF,A0        Turn Highlight off
  899. 000022CC  4EB8 1502                        899          JSR    PRINT
  900. 000022D0                                   900  
  901. 000022D0  303C 0000                        901          MOVE.W    #0,D0
  902. 000022D4  323C 0017                        902          MOVE.W    #23,D1
  903. 000022D8  4EB8 1C26                        903          JSR    POSITION
  904. 000022DC                                   904  
  905. 000022DC  207C 000023F2                    905  MI_AGAIN:    MOVE.L    #MI_PROMPT,A0        Print prompt
  906. 000022E2  4EB8 1502                        906          JSR    PRINT
  907. 000022E6                                   907  
  908. 000022E6  207C 000023E4                    908          MOVE.L    #MI_INPUT,A0
  909. 000022EC  227C 000023D8                    909          MOVE.L    #MI_VALID,A1
  910. 000022F2  7005                             910          MOVE.L    #5,D0
  911. 000022F4  4EB8 1430                        911          JSR    INPUT            INPUT the number
  912. 000022F8                                   912  
  913. 000022F8  700A                             913          MOVE.L    #10,D0            NEWLINE
  914. 000022FA  4EB8 14D0                        914          JSR    PUTC
  915. 000022FE                                   915  
  916. 000022FE  207C 000023E4                    916          MOVE.L    #MI_INPUT,A0
  917. 00002304  4EB8 1B7E                        917          JSR    ATOL            Convert ASCII to Long INT
  918. 00002308  23C0 000023B6                    918          MOVE.L    D0,MI_INN
  919. 0000230E                                   919  
  920. 0000230E  0C40 03E8                        920          CMPI.W    #1000,D0        Make sure number is right
  921. 00002312  6E00 000E                        921          BGT    MI_ER            size
  922. 00002316  0C40 FC18                        922          CMPI.W    #-1000,D0
  923. 0000231A  6D00 0006                        923          BLT    MI_ER
  924. 0000231E                                   924          
  925. 0000231E  6000 0010                        925          BRA    MI_NER
  926. 00002322                                   926  
  927. 00002322  207C 00002402                    927  MI_ER:        MOVE.L    #MI_ERROR,A0        Print Error Message
  928. 00002328  4EB8 1502                        928          JSR    PRINT
  929. 0000232C  4EF8 22DC                        929          JMP    MI_AGAIN        Try Again!!!
  930. 00002330                                   930  
  931. 00002330  23FC 20202020 000023CA           931  MI_NER:        MOVE.L    #$20202020,MI_OUT      Set output to all spaces
  932. 0000233A  23FC 20000000 000023CE           932          MOVE.L    #$20000000,MI_OUT+4
  933. 00002344  207C 000023D0                    933          MOVE.L    #MI_OUT+6,A0
  934. 0000234A  7200                             934          MOVEQ    #0,D1
  935. 0000234C  2239 000023B6                    935          MOVE.L    MI_INN,D1
  936. 00002352  4EB8 1B36                        936          JSR    LTOA
  937. 00002356                                   937  
  938. 00002356  1033 6000                        938                 MOVE.B 0(A3,D6),D0
  939. 0000235A  1234 7000                        939          MOVE.B 0(A4,D7),D1
  940. 0000235E  4EB8 1C26                        940          JSR    POSITION
  941. 00002362                                   941  
  942. 00002362  207C 000023CA                    942          MOVE.L    #MI_OUT,A0        Print Entry
  943. 00002368  4EB8 1502                        943          JSR    PRINT
  944. 0000236C                                   944  
  945. 0000236C  2079 00002460                    945          MOVE.L    MI_DATA,A0
  946. 00002372  3039 00002466                    946          MOVE.W    MI_COL,D0
  947. 00002378  C0C7                             947          MULU    D7,D0            D0=row*col
  948. 0000237A  C0FC 0002                        948          MULU    #2,D0            *2
  949. 0000237E                                   949  
  950. 0000237E  3206                             950          MOVE.W    D6,D1
  951. 00002380  C2FC 0002                        951          MULU    #2,D1
  952. 00002384  D041                             952          ADD.W    D1,D0
  953. 00002386                                   953  
  954. 00002386  21B9 000023B8 0000               954          MOVE.L    MI_INN+2,0(A0,D0)        Store entry in Matrix Buffer
  955. 0000238E                                   955  
  956. 0000238E  5246                             956          ADDQ.W    #1,D6
  957. 00002390  BC79 00002466                    957          CMP.W    MI_COL,D6
  958. 00002396  6600 FF0E                        958          BNE    MI_L5
  959. 0000239A                                   959  
  960. 0000239A  5247                             960          ADDQ.W    #1,D7
  961. 0000239C  BE79 00002464                    961          CMP.W    MI_ROW,D7
  962. 000023A2  6600 FF00                        962          BNE    MI_L4
  963. 000023A6                                   963  
  964. 000023A6                                   964  * Reset the terminal's scrolling region
  965. 000023A6                                   965  
  966. 000023A6  207C 0000243F                    966          MOVE.L    #MI_SRR,A0
  967. 000023AC  4EB8 1502                        967          JSR    PRINT
  968. 000023B0                                   968  
  969. 000023B0                                   969  
  970. 000023B0                                   970  * Return to calling routine
  971. 000023B0                                   971  
  972. 000023B0  4CDF 7FFF                        972          MOVEM.L    (A7)+,A0-A6/D0-D7    Restore Registers
  973. 000023B4                                   973  
  974. 000023B4  4E75                             974          RTS                Return to caller
  975. 000023B6                                   975  
  976. 000023B6                                   976  
  977. 000023B6  00000000 00000000 00000000 ...   977  MI_INN:         DC.L   0,0,0,0,0
  978. 000023CA  2D 31 30 30 30 00 00 00 00 ...   978  MI_OUT:         DC.B    '-1000',0,0,0,0,0,0,0,0,0
  979. 000023D8  30 31 32 33 34 35 36 37 38 ...   979  MI_VALID:       DC.B    '0123456789-',0
  980. 000023E4  00 00 00 00 00 00 00 00 00 ...   980  MI_INPUT:       DC.B    0,0,0,0,0,0,0,0,0,0,0,0,0,0
  981. 000023F2  45 6E 74 65 72 20 45 6C 65 ...   981  MI_PROMPT:      DC.B    'Enter Element: ',0
  982. 00002402  2A 2A 2A 20 50 72 6F 62 6C ...   982  MI_ERROR:       DC.B    '*** Problem with entry!!!!',10,10,0,0
  983. 00002420  20 20 20 20 20 00 00             983  MI_SPACE:       DC.B    '     ',0,0
  984. 00002427  1B 5B 35 3B 37 6D 00 00          984  MI_HON:         DC.B    27,'[5;7m',0,0
  985. 0000242F  1B 5B 30 6D 00 00                985  MI_HOFF:        DC.B    27,'[0m',0,0
  986. 00002435  1B 5B 32 30 3B 32 33 72 00 00    986  MI_SSR:         DC.B    27,'[20;23r',0,0
  987. 0000243F  1B 5B 30 3B 32 34 72 00          987  MI_SRR:         DC.B    27,'[0;24r',0
  988. 00002447  00 00 00 00 00 00 00 00 00 ...   988  MI_Y:           DC.B    0,0,0,0,0,0,0,0,0,0,0,0
  989. 00002453  00 00 00 00 00 00 00 00 00 ...   989  MI_X:           DC.B    0,0,0,0,0,0,0,0,0,0,0,0
  990. 00002460  00000000                         990  MI_DATA:        DC.L    0
  991. 00002464  0000                             991  MI_ROW:         DC.W    0
  992. 00002466  0000                             992  MI_COL:         DC.W    0
  993. 00002468                                   993  
  994. 00002468                                   994  
  995. 00002468  207C 000024A8                    995  EXIT:        MOVE.L        #QUITMSG,A0    *INITIALIZE QUIT PROMPT
  996. 0000246E  4EB8 1502                        996          JSR         PRINT        *PRINT QUIT PROMPT
  997. 00002472  4EB8 14F0                        997          JSR        GETC        *GET RESPONSE
  998. 00002476  B03C 0059                        998          CMP.B        #$59,D0        *A VALID CHARACTER?
  999. 0000247A  6700 001C                        999          BEQ        QSTRT        *YES, START OVER
  1000. 0000247E  B03C 0079                       1000          CMP.B        #$79,D0        *A VALID CHARACTER?
  1001. 00002482  6700 0014                       1001          BEQ        QSTRT        *YES, START OVER
  1002. 00002486  B03C 004E                       1002          CMP.B        #$4E,D0        *A VALID CHARACTER?
  1003. 0000248A  6700 0010                       1003          BEQ        QFIN        *NO, QUIT PROGRAM
  1004. 0000248E  B03C 006E                       1004          CMP.B        #$6E,D0        *A VALID CHARACTER?
  1005. 00002492  6700 0008                       1005          BEQ        QFIN        *NO, QUIT PROGRAM
  1006. 00002496  60D0                            1006          BRA        EXIT        *NOT A VALID CHARACTER
  1007. 00002498                                  1007  
  1008. 00002498  6000 EB90                       1008  QSTRT:        BRA        MAIN        *RE-EXECUTE MAIN PROGRAM
  1009. 0000249C                                  1009  
  1010. 0000249C  207C 000024CD                   1010  QFIN:        MOVE.L        #ENDMSG,A0    *INITIALIZE FINAL MESSAGE
  1011. 000024A2  4EB8 1502                       1011          JSR        PRINT        *PRINT FINAL MESSAGE
  1012. 000024A6  60FE                            1012  NOMOE:        BRA        NOMOE        *INFINITE LOOP
  1013. 000024A8                                  1013  
  1014. 000024A8  0A 4D 75 6C 74 69 70 6C 79 ...  1014  QUITMSG:    DC.B        10,'Multiply Another Set? <Y,y,N,n>...',0,0
  1015. 000024CD  0A 0A 54 48 41 4E 4B 20 59 ...  1015  ENDMSG:        DC.B        10,10,'THANK YOU, GOODBYE..',0
  1016. 000024E4                                  1016  
  1017. 000024E4                                  1017  
  1018.  
  1019. No errors detected
  1020. No warnings generated
  1021.